#ifndef RESOURCE_VIEW_H
#define RESOURCE_VIEW_H
#include "async/function.h"
#include "http/request.h"
#include "http/response.h"


class View {
public:
    explicit View(Request* request = nullptr);
    virtual ~View() {}

    virtual async<> dispatch(Request* request);
    virtual async<> GET(Request* request);
    virtual async<> POST(Request* request);
    virtual async<> PUT(Request* request);
    virtual async<> HEAD(Request* request);
    virtual async<> PATCH(Request* request);
    virtual async<> DELETE(Request* request);

protected:
    Request* request = nullptr;
};


class HelloView : public View {
public:
    explicit HelloView(Request* request = nullptr);

    async<> GET(Request* request)override;
};


#endif //RESOURCE_VIEW_H
